/*
 * Material.cpp
 *
 *  Created on: Feb 15, 2011
 *      Author: alki
 */

#include "Material.h"
#include <stdlib.h>

Material::Material() {
	this->m_textur = NULL;
	this->m_ambient = FARBE(0,0,0);
	this->m_diffus = FARBE(0,0,0);
	this->m_emissive = FARBE(0,0,0);
	this->m_specular = FARBE(0,0,0);
	this->m_reflexion = 0;
	this->m_transmission = 0;
	this->m_brechung = 1;
	this->m_specexp = 20;
	this->m_diffusfaktor = 1;
	this->m_specularfaktor = 0;
	this->m_u = 0;
	this->m_v = 0;
}

Material::~Material() {
	this->m_textur = NULL;
}

FARBE Material::getTexColor() const {
	return this->m_textur->getPixel(this->m_u,this->m_v);
}

bool FARBE::operator==(FARBE vergleich) const {
	if(this->r!=vergleich.r) return false;
	if(this->g!=vergleich.g) return false;
	if(this->b!=vergleich.b) return false;

	return true;
}

bool Material::operator==(Material vergleich) const {
	if(this->m_ambient!=vergleich.m_ambient) return false;
	if(this->m_diffus!=vergleich.m_diffus) return false;
	if(this->m_specular!=vergleich.m_specular) return false;
	if(this->m_emissive!=vergleich.m_emissive) return false;

	if(this->m_transmission!=vergleich.m_transmission) return false;
	if(this->m_reflexion!=vergleich.m_reflexion) return false;
	if(this->m_brechung!=vergleich.m_brechung) return false;
	if(this->m_specexp!=vergleich.m_specexp) return false;
	if(this->m_diffusfaktor!=vergleich.m_diffusfaktor) return false;
	if(this->m_specularfaktor!=vergleich.m_specularfaktor) return false;

	return true;
}
